forum

home / developersection / forums / how to sort a map<key, value> on the values in java?

How to sort a Map<Key, Value> on the values in Java?

Anonymous User 1753 13-May-2015
I am relatively new to Java, and often find that I need to sort a Map<Key, Value> on the values. Since the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key. Is there an easier way?

Updated on 14-May-2015

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By